home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Palettes / BarChart / ChartOfMatrix.h < prev    next >
Text File  |  1992-12-20  |  5KB  |  172 lines

  1. /* 
  2.  * BarChart, A simple multi source loadable class.
  3.  *
  4.  *    Written by: Joe Freeman 7/92
  5.  *    
  6.  *    HSB color sweep stolen from some of Randy Nelson's code
  7.  *        should use NXEqualColor() for duplicates
  8.  *
  9.  */
  10. /* bar spacing:Each plot is a width of 2N and each gap is a width of 1N
  11.  *    The total width is m*(2N+N) + N  = 3mN+N = where m is number of bars
  12.  *    Thus N = width / (3m+1)
  13.  */
  14.  
  15. /* Generated by Interface Builder */
  16.  
  17. #import <appkit/appkit.h>
  18. #import <dbkit/dbkit.h>
  19.  
  20. typedef enum _graphType {
  21.     DRAW_H_BAR    = 0,
  22.     DRAW_V_BAR    = 1,
  23.     DRAW_H_LINE    = 2,
  24.     DRAW_V_LINE    = 3    /* not impl */
  25.     } graphType;
  26.     
  27.  
  28. @interface ChartOfMatrix:View
  29. {
  30.     id    dataSrc;        /* only connect in nib if is really matrix */
  31.     id    minField;
  32.     id    maxField;
  33.     id    meanField;
  34.  
  35.     float    minSheetSet, maxSheetSet;/* min and max size  if not auto */
  36.     float    vMargin,hMargin;/* size of top/bottom, right/left margins */
  37.     struct _COM_Flags {
  38.         BOOL    autoScale:1;    /*  set vertical on fly or from xxxSheetSet */
  39.     BOOL    randomBarColors:1;/* random color for the bars */
  40.     BOOL    drawFrame:1;    /* the black line around the plot */
  41.     unsigned drawType:3;    /* bars, h, v, line */
  42.     unsigned dummy:10;
  43.     } COM_Flags;
  44.     NXColor    backgroundColor;
  45.     NXColor    highlightColor;
  46.     unsigned int    highlightIndex;    /* currently selected row */
  47.     int        numPrototypes;    /* number of prototype bars/ points disp IB */
  48.     int        borderType;    /* should we bezel */
  49.     
  50.     id        mrExpression,mrFetchGroup; /* if getting fed from recordList */
  51.  
  52. }
  53.  
  54. - initFrame:(NXRect *)r;
  55. - awake;
  56.  
  57. /*============================================================
  58.  * color dragging support
  59.  *============================================================*/
  60.  
  61. - (NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender;
  62. - (BOOL)performDragOperation:(id <NXDraggingInfo>)sender;
  63.  
  64. /*============================================================
  65.  * instance set / query methods
  66.  *============================================================*/
  67.  
  68. - setGraphType:(int)drawCode;
  69. - (int)graphType;
  70.  
  71. /* */
  72. - takeRandomColorStateFrom:sender;
  73. - setRandomBarColorEnabled:(BOOL)flag;
  74. - (BOOL)isRandomBarColorEnabled;
  75. - takeBackgroundColorFrom:sender;
  76. - setBackgroundColor:(NXColor)aColor;
  77. - (NXColor)backgroundColor;
  78. - takeHighlightColorFrom:sender;
  79. - setHighlightColor:(NXColor)aColor;
  80. - (NXColor)highlightColor;
  81.  
  82.  
  83. /* set and query the size for the margins (in points) */
  84. - takeHMarginFrom:sender;
  85. - takeVMarginFrom:sender;
  86. - (float)hMargin;
  87. - (float)vMargin;
  88.  
  89. /* fancy controls */
  90. - takeFrameStateFrom:sender;
  91. - (BOOL)frameState;
  92. - takeNumProtosFrom:sender;
  93. - (int)numProtos;
  94. - takeBorderTypeFrom:sender;    /* what type of bezel  gets sender's tag*/
  95. - (int)borderType;
  96.  
  97. - takeAutoScaleStateFrom:sender;
  98. - setAutoScale:(BOOL)flag;
  99. - (BOOL)autoScale;
  100.  
  101. /* when autoscale is off, set the min and max for the sheet */
  102. - takeMinValueFrom:sender;
  103. - takeMaxValueFrom:sender;
  104. - (double)minValue;
  105. - (double)maxValue;
  106.  
  107. /*============================================================
  108.  * pasteboard
  109.  *============================================================*/
  110.  
  111. - copy:sender;
  112.  
  113. /*============================================================
  114.  * do real work
  115.  *============================================================*/
  116.  
  117. - (int)numLocations;
  118. - (float)valueOfLocation:(int)n;
  119. - calcRect:(NXRect *)r 
  120.     ofBar:(int)n 
  121.     insideRect:(NXRect *)boundingRect
  122.     usingMin:(float)minSheetVal;
  123.  
  124. /*============================================================
  125.  * target action loading
  126.  *============================================================*/
  127.  
  128. - plotFromMatrix:sender;
  129.     /* we get this when DBModule fetches new batch of values */
  130.     
  131. /*============================================================
  132.  * dbKit feed
  133.  *============================================================*/
  134.  
  135. - associationContentsDidChange:association;
  136.     /* we get this when values are updated via UI */
  137. - association:association setValue:(DBValue *)value;
  138.     /* we get this when the selection changes */
  139. - associationSelectionDidChange:association;
  140.     /* we get this when a row is deleted */
  141. - associationCurrentRecordDidDelete:association;
  142.  
  143.  
  144. /*============================================================
  145.  * do a selection with the mouse
  146.  *============================================================*/
  147.  
  148. - mouseDown:(NXEvent *)theEvent;
  149.  
  150. /*============================================================
  151.  * archiving for the inspector 
  152.  *============================================================*/
  153.  
  154. - read:(NXTypedStream *)stream;
  155. - write:(NXTypedStream *)stream;
  156.  
  157. /*============================================================
  158.  * rendering 
  159.  *============================================================*/
  160.  
  161. - calcMin:(float *)rMin andMax:(float *)rMax andMean:(float *)rMean;
  162. - renderVLines:(NXRect *)r  min:(float )minSheetVal max:(float )maxSheetVal;
  163. - renderBars:(NXRect *)r min:(float )minSheetVal max:(float )maxSheetVal;
  164.  
  165. /*============================================================
  166.  * rendering 
  167.  *============================================================*/
  168.  
  169. - drawSelf:(NXRect *)r :(int)c;
  170.  
  171. @end
  172.